using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Anthem;

namespace UsrControls
{
    class AddTemplate : ITemplate
    {
        string _imagePath = String.Empty;
        bool _DesignMode = true;

        public AddTemplate(string strImagePath, bool blnDesignMode)
        {
            _imagePath = strImagePath;
            _DesignMode = blnDesignMode;
        }

        public AddTemplate()
        {
        }

        public void InstantiateIn(Control container)
        {
            LinkButton btn = new LinkButton();
            btn.ID = "btnAdd";

            if (_DesignMode)
            {
                btn.Text = @"<img src=""../../icons/ico_grabar.gif"" border=""0"" alt=""Grabar"">";
            }
            else if (_imagePath != String.Empty)
            {
                btn.Text = @"<img src=""" + _imagePath + @"/icons/ico_grabar.gif"" border=""0"" alt=""Grabar"">";
            }

            btn.CommandName = "Insert";
            container.Controls.Add(btn);
        }
    }
}
